#pragma once
#include<iostream>
#include<string>
#include <boost/algorithm/string.hpp>
#include<fstream>
#include"inc/cppjieba/Jieba.hpp"
namespace util
{
class fileutil
{
public:
static bool readfile(const std::string&filepath,std::string&text)
{
    std::ifstream in(filepath,std::ios::in);
    if(!in.is_open())
    {
        std::cout<<"file open error"<<std::endl;
        return false;
    }
    std::string line;
    while(std::getline(in,line))
    {
        text+=line;
    }
    in.close();
    return true;
}
};
class stringutil
{
public:
static bool cut(std::vector<std::string>&an,std::string&line,std::string&sep)
{
    boost::algorithm::split(an,line,boost::is_any_of(sep));
    return true;
}
};
const char* const DICT_PATH = "./dict/jieba.dict.utf8";
const char* const HMM_PATH = "./dict/hmm_model.utf8";
const char* const USER_DICT_PATH = "./dict/user.dict.utf8";
const char* const IDF_PATH = "./dict/idf.utf8";
const char* const STOP_WORD_PATH = "./dict/stop_words.utf8";


class jiebautil
{
    private:
 static cppjieba::Jieba jieba;
        public:
static bool CutString(std::string&src,std::vector<std::string>&result)
        {
jieba.CutForSearch(src,result);
return true;
        }
};
 cppjieba::Jieba jiebautil::jieba(DICT_PATH,
        HMM_PATH,
        USER_DICT_PATH,
        IDF_PATH,
        STOP_WORD_PATH);
}